package com.yin.singlemode;

import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;

// enum 是什么？  本身也是一个class类
public enum Enum {

    INSTANCE;
    public Enum getInstance(){
        return INSTANCE;
    }

}

class Test {
    public static void main(String[] args) throws NoSuchMethodException, InvocationTargetException, InstantiationException, IllegalAccessException {
        Enum instance = Enum.INSTANCE;

        Constructor<Enum> declaredConstructor = Enum.class.getDeclaredConstructor(String.class,int.class);
        declaredConstructor.setAccessible(true);
        System.out.println(instance);
        Enum anEnum = declaredConstructor.newInstance();
        System.out.println(anEnum);

    }
}
